;;! gc = true
;;! simd = true

(module
  (type $func_ty (func))
  (type $struct_ty (struct))

  (type $a (array i8))
  (type $b (array i16))
  (type $c (array i32))
  (type $d (array i64))
  (type $e (array f32))
  (type $f (array f64))
  (type $g (array v128))
  (type $h (array funcref))
  (type $i (array (ref $func_ty)))
  (type $j (array nullfuncref))
  (type $k (array externref))
  (type $l (array nullexternref))
  (type $m (array anyref))
  (type $n (array eqref))
  (type $o (array structref))
  (type $p (array (ref $struct_ty)))
  (type $q (array arrayref))
  (type $r (array (ref $a)))
  (type $s (array i31ref))
  (type $t (array nullref))

  (elem declare funcref (ref.func $f))
  (func $f (export "f")
    (drop (array.new $a (i32.const 0xff) (i32.const 3)))
    (drop (array.new $b (i32.const 0xffff) (i32.const 3)))
    (drop (array.new $c (i32.const 0xffffffff) (i32.const 3)))
    (drop (array.new $d (i64.const 0xffffffffffffffff) (i32.const 3)))
    (drop (array.new $e (f32.const 0.0) (i32.const 3)))
    (drop (array.new $f (f64.const 0.0) (i32.const 3)))
    (drop (array.new $g (v128.const i32x4 1 2 3 4) (i32.const 3)))
    (drop (array.new $h (ref.func $f) (i32.const 3)))
    (drop (array.new $i (ref.func $f) (i32.const 3)))
    (drop (array.new $j (ref.null nofunc) (i32.const 3)))
    (drop (array.new $k (ref.null extern) (i32.const 3)))
    (drop (array.new $l (ref.null noextern) (i32.const 3)))
    (drop (array.new $m (array.new_default $a (i32.const 1)) (i32.const 3)))
    (drop (array.new $n (array.new_default $b (i32.const 1)) (i32.const 3)))
    (drop (array.new $o (struct.new $struct_ty) (i32.const 3)))
    (drop (array.new $p (struct.new $struct_ty) (i32.const 3)))
    (drop (array.new $q (array.new_default $b (i32.const 1)) (i32.const 3)))
    (drop (array.new $r (array.new_default $a (i32.const 1)) (i32.const 3)))
    (drop (array.new $s (ref.i31 (i32.const 0x12345678)) (i32.const 3)))
    (drop (array.new $t (ref.null none) (i32.const 3)))
  )
)

(assert_return (invoke "f"))
